package com.java.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.java.po.Grade;
import com.java.po.GradeMap;
import com.java.po.Root;
import com.java.po.Salary;
import com.java.po.SalaryMap;
import com.java.service.RootService;
import com.java.service.SalaryService;
import com.java.service.impl.SalaryServiceImpl;
import com.java.tool.AjaxJson;

/**
 * Title:SalaryController.java
 * Description:
 * @author:sprogrammer
 * @time:2018年3月22日下午5:37:42
 */
@Controller
@CrossOrigin()
@RequestMapping(method=RequestMethod.POST)
public class SalaryController {
	
	private AjaxJson ajaxJson;
	private SalaryService service;
	
	public SalaryController(){
		ajaxJson = new AjaxJson();
		service = new SalaryServiceImpl();
	}
	
	@RequestMapping(value="/updateSalaryById")
	public @ResponseBody AjaxJson updateSalaryById(@RequestBody Salary salary) throws Exception{		
		ajaxJson=service.updateSalaryById(salary);
		return ajaxJson;
	}
	
	@RequestMapping(value="/insertSalary")
	public @ResponseBody AjaxJson insertSalary(@RequestBody Salary salary) throws Exception{		
		ajaxJson=service.insertSalary(salary);
		return ajaxJson;
	}
	
	@RequestMapping(value="/deleteSalaryById")
	public @ResponseBody AjaxJson deleteSalaryById(@RequestBody Salary salary) throws Exception{		
		ajaxJson=service.deleteSalaryById(salary);
		return ajaxJson;
	}
	
	@RequestMapping(value="/findAllSalary")
	public @ResponseBody AjaxJson findAllSalary(@RequestBody SalaryMap salaryMap) throws Exception{		
		ajaxJson=service.findAllSalary(salaryMap);
		return ajaxJson;
	}
	
	@RequestMapping(value="/findSalaryByid")
	public @ResponseBody AjaxJson findSalaryByid(@RequestBody Salary salary) throws Exception{		
		ajaxJson=service.findSalaryByid(salary);
		return ajaxJson;
	}
}
